package com.itheima.servlet01;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//响应图片到浏览器

@WebServlet("/ServletDemo666")
public class ServletDemo666 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置请求域数据
//        req.setAttribute("username1","zhangsan");
        //设置重定向
//        resp.sendRedirect(req.getContextPath()+"/ServletDemo777");
      resp.sendRedirect("http://www.baidu.com");


    }






    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
